import requests

url = "https://api.siliconflow.cn/v1/chat/completions"

payload = {
    "model": "deepseek-ai/DeepSeek-V3",
    "messages": [
        {
            "role": "user",
            "content": "Convert these features into a sales pitch in under 100 words: 24hr battery, noise-cancelling, sweatproof."
        }
    ],
    "stream": False,
    "max_tokens": 512,
    "stop": None,
    "temperature": 0.7,
    "top_p": 0.7,
    "top_k": 50,
    "frequency_penalty": 0.5,
    "n": 1,
    "response_format": {"type": "text"},
}
headers = {
    "Authorization": "Bearer sk-yvluzyvgxkoacnzsiijjtpzpldevpvfbvbgkptlbhgpdvhmr",
    "Content-Type": "application/json"
}

response = requests.request("POST", url, json=payload, headers=headers)
print(response.json())

text = response.json()["choices"][0]["message"]["content"]
print(text)
